import { globalIgnores } from "eslint/config";
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";
import pluginVue from "eslint-plugin-vue";

// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

export default defineConfigWithVueTs(
  {
    name: "app/files-to-lint",
    files: ["**/*.{ts,mts,tsx,vue}"],
  },

  globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),

  pluginVue.configs["flat/essential"],
  vueTsConfigs.recommended,

  // 新增规则配置
  {
    rules: {
      "@typescript-eslint/no-explicit-any": "warn", // 提示尽量不用 any 类型
      // 强制单文件组件名使用 PascalCase
      "vue/component-name-in-template-casing": ["error", "PascalCase"],
      // 允许 PascalCase 文件名（如 Login.vue）
      "vue/filename-extension": ["error", { extensions: [".vue"], case: "pascal" }],
    },
  }
);
